package com.tqjc.system.common.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author 86195
 * @version 1.0
 * @description 道闸类型枚举
 * @date 2023/10/7 15:44
 */
@AllArgsConstructor
@NoArgsConstructor
@Getter
public enum GateTypeEnum {





    GATE_1_INLET_left("192.168.2.55",GateActionEnum.TYPE_EXIT,"道闸1入口左摄像头"),
    GATE_1_INLET_right("192.168.2.58",GateActionEnum.TYPE_EXIT,"道闸1入口右摄像头"),
    GATE_1_OUTLET_left("192.168.2.56",GateActionEnum.TYPE_ENTER,"道闸1出口左摄像头"),
    GATE_1_OUTLET_right("192.168.2.57",GateActionEnum.TYPE_ENTER,"道闸1出口右摄像头"),
    GATE_2_INLET("192.168.2.53",GateActionEnum.TYPE_EXIT,"道闸2入口"),
    GATE_2_OUTLET("192.168.2.54",GateActionEnum.TYPE_ENTER,"道闸2出口"),

            ;

    /**
     * 摄像头ip
     */
    private String ip;

    /**
     * 摄像头动作类型
     */
    private GateActionEnum type;
    /**
     * 描述信息
     */
    private String desc;



    public static GateTypeEnum getGateTypeEnum(String ip){
        for (GateTypeEnum value : GateTypeEnum.values()) {
            if(value.getIp().equals(ip)){
                return value;
            }
        }

        return null;
    }


    public static GateActionEnum getGateActionEnum(String ip){
        for (GateTypeEnum value : GateTypeEnum.values()) {
            if(value.getIp().equals(ip)){
                return value.getType();
            }
        }

        return null;
    }




}
